package cn.net.wanji.utils;

import java.util.HashMap;
import java.util.Map;

public class Test3 {

    public static void main(String[] args) {

        String[] nginxs = {
                "http://10.102.1.157:9092/dist1",
                "http://10.102.1.157:9092/dist2",
                "http://10.102.1.157:9092/dist3",
                "http://10.102.1.157:9092/dist4"
        };


        String[] recordId = {
                "G00051100100000011020230116055047228",
                "G00051100100000011020230116055048245",
                "G00051100100000011020230116055054331",
                "G00051100100000011020230116055055341",
                "G00051100100000011020230116055103457",
                "G00051100100000011020230116055104470",
                "G00051100100000011020230116055108520",
                "G00051100100000011020230116055109538"
        };

        Map<Integer, Integer> map = new HashMap<>();

        for (String s : recordId) {
            int i1 = Math.abs(s.hashCode());
            System.out.println(i1);
            int key = i1 % nginxs.length;
            if (map.containsKey(key)) {
                map.put(key, map.get(key) + 1);
            } else {
                map.put(key, 1);
            }
        }

        System.out.println(map);



    }

}

